﻿using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Trippy.CollidableGameComponents;
using Trippy.CollidableGameComponents.Objects;
using Trippy.CollidableGameComponents.Agents;
using Trippy.Levels;

namespace Trippy.Abilities
{
    class Key : Ability
    {
        public Key(Level level) : base (level)
        {
            name = "Key";
            icon = CurrentLevel.Game.Content.Load<Texture2D>("Sprites/Ability Icons/key");
        }

        public override void OnAdd()
        {
            State = AbilityState.Available;
        }

        public override bool OnCollide(CollidableGameComponent component, Trippy.CollidableGameComponents.CollidableGameComponent.CollisionSide side)
        //event when hero collides with something else
        {
            if (component is Door)
            {
                component.MarkForDeletion();
                CurrentLevel.Hero.RestoreAbility();
            }
            return false;
        }
    }
}
